reftests: Add a test for descendant CSS selectors match
authorBenjamin Otte <otte@redhat.com>
Sun, 15 May 2011 11:24:10 +0000 (13:24 +0200)
committerBenjamin Otte <otte@redhat.com>
Wed, 18 May 2011 20:17:56 +0000 (22:17 +0200)
In widget hierarchy like "Foo Bar Bar Baz", we want the selector "Foo >
Bar Baz" to match, because it matches the elements 1, 2 and 4.
Previously, the selector only matches the Bar at position 3 and then
failed because it wasn't preceded by a Foo.

tests/reftests/Makefile.am
tests/reftests/css-match-descendant-later.css [new file with mode: 0644]
tests/reftests/css-match-descendant-later.ref.ui [new file with mode: 0644]
tests/reftests/css-match-descendant-later.ui [new file with mode: 0644]

index ab86b8509789130e155c38b25b10030327df1336..216888507ccd3445ff1e898e2ff92d0310b6b360 100644 (file)
@@ -32,6 +32,9 @@ EXTRA_DIST += \
        css-match-class.css \
        css-match-class.ref.ui \
        css-match-class.ui \
+       css-match-descendant-later.css \
+       css-match-descendant-later.ref.ui \
+       css-match-descendant-later.ui \
        css-match-name.css \
        css-match-name.ref.ui \
        css-match-name.ui \
diff --git a/tests/reftests/css-match-descendant-later.css b/tests/reftests/css-match-descendant-later.css
new file mode 100644 (file)
index 0000000..421b6d4
--- /dev/null
@@ -0,0 +1,11 @@
+GtkEventBox {
+  background-color: blue
+}
+
+GtkGrid GtkEventBox {
+  background-color: red
+}
+
+GtkWindow > GtkGrid GtkEventBox {
+  background-color: blue
+}
diff --git a/tests/reftests/css-match-descendant-later.ref.ui b/tests/reftests/css-match-descendant-later.ref.ui
new file mode 100644 (file)
index 0000000..1afc99b
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkWindow" id="window1">
+    <property name="can_focus">False</property>
+    <property name="type">popup</property>
+    <child>
+      <object class="GtkEventBox" id="eventbox1">
+        <property name="width_request">10</property>
+        <property name="height_request">10</property>
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <child>
+          <placeholder/>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/tests/reftests/css-match-descendant-later.ui b/tests/reftests/css-match-descendant-later.ui
new file mode 100644 (file)
index 0000000..68c8f58
--- /dev/null
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkWindow" id="window1">
+    <property name="can_focus">False</property>
+    <property name="type">popup</property>
+    <child>
+      <object class="GtkGrid" id="grid1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <child>
+          <object class="GtkGrid" id="grid2">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <child>
+              <object class="GtkEventBox" id="eventbox1">
+                <property name="width_request">10</property>
+                <property name="height_request">10</property>
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <child>
+                  <placeholder/>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">0</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">0</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>